# Maintainer: Oliver Smith <ollipearanoid@postmarketos.org>
# pmbootstrap installs this, if systemd is selected in "pmbootstrap init".
pkgname=postmarketos-base-systemd
pkgver=14
pkgrel=0
pkgdesc="Meta package for running postmarketOS with systemd"
url="https://postmarketos.org"
arch="noarch"
license="GPL-3.0-or-later"
options="!check"

# systemd <-> util-linux is an expected cycial dependency
# Also we can't parse .note.dlopen yet.
#
# Optional dependencies by systemd, but needed on an actual system:
# less
# login-utils
# so:libkmod.so.2
depends="
	less
	linux-pam-pmos
	login-utils
	openssh-server-pam
	polkit>9990
	rtkit
	so:libkmod.so.2
	systemd
	systemd-services
	systemd-timesyncd
	tzdata
	"
replaces="alpine-baselayout postmarketos-base systemd systemd-logind"
replaces_priority=100

_source644="
	etc/motd.ansi
	etc/profile.d/99motd.sh
	etc/systemd/logind.conf
	etc/ssh/sshd_config.d/usepam.conf
	usr/share/mkinitfs/files/01-initramfs-base-systemd.files
	usr/lib/systemd/system-preset/90-base.preset
	usr/lib/systemd/user-preset/90-base.preset
"

_source755="
	usr/bin/setup-timezone
"

flatpath() {
	local i
	for i in $@; do
		echo "rootfs-$i" | sed s./.-.g
	done
}
source="$(flatpath $_source644 $_source755)"

package() {
	local i
	for i in $_source644; do
		install -Dm644 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
	done
	for i in $_source755; do
		install -Dm755 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
	done

	# This gets printed still so overwrite it with an empty file.
	touch $pkgdir/etc/motd
}

sha512sums="
793ee54a0313a0a20664e8dd90561376b3d5f9b870d292a77ab8fc7507f7f5c6d648e7de6ee98916be3702fcdaac5ca8b3648b33503547e419d0fe683bf77baa  rootfs-etc-motd.ansi
fbaa33425e507062a454f11bda48508f261c2144e5c23a20f567dc1cef14ce1dec57f8d934f418f5b6095509757f8503481aba9790a04c8f9f6995e65833d8c9  rootfs-etc-profile.d-99motd.sh
2faac294bb632762e247b850f09ff4b544ccff6c462efd8d4faca71ba30bdfa9c460377a0dc88e92c5dbbe251017d164064a56ac0e0410f224b45d4f5f81866c  rootfs-etc-systemd-logind.conf
208f53c1d142151277cfcf0a95df839919ce8cb15ec888d50890dc6b3631a994335bfa12194cec856b649f97cfd7c80019c595cc0ea2c5ee96498a3e76a9950b  rootfs-etc-ssh-sshd_config.d-usepam.conf
15423bfda57c90ab62fe69865ca4072a0aeb83bf77d9c278257e346f4da81843d010b41003c91ae9f3fcb1c67447645e7c19078eea2bf11312051e6ad7523ad1  rootfs-usr-share-mkinitfs-files-01-initramfs-base-systemd.files
fa99e8db4dca4cdb3581d13a7502ebe9716e457dd81c140d73cc4db4561ed35ad1dc3d40c006acfd99713cc5b9ed1037da1078c111b88953aa8337c3f4eb74b3  rootfs-usr-lib-systemd-system-preset-90-base.preset
aaa5af21270364495573c1e2503f8521fa1ea39ba12742d4edc459284b19dc70f7840daf0225a2e965a4f21ce2c310693e80c2e69d7b8e1b8fe477fa7c26942d  rootfs-usr-lib-systemd-user-preset-90-base.preset
605df1f004783d2e0ec5dd99a688bca27502c8c24bc05fb4dc26589b2070b0fbd1cf9bd56e6861d7cda2f8ac8147e7eb040acfd886185c01c8cf9de8b1ce2dcd  rootfs-usr-bin-setup-timezone
"
